import request from '../utils/request';

import { UrlConfig} from './fetch';
const option = function(data){
  return{
      method: 'post',
      headers: {'Content-Type': 'application/json; charset=utf-8'},
      body: JSON.stringify(data)
    }
}
/**
 * 获取分类 版面列表
 */
export function getTypeList() {
    let token = localStorage.getItem('token') ? localStorage.getItem('token') : '';//获取当前用户授权的版面

  return request(UrlConfig+'/fcinformation/Plate/plateList?type=admin&token='+token);
}
/**
 * 获取模板列表
 */
export function getModalList() {
  return request(UrlConfig+'/fcinformation/Template/templateList');
}
/**
 * 删除单个分类
 * id  分类id
 */
export function deleteType(id) {
  return request(UrlConfig+'/fcinformation/Plate/deletePlate',option(id));
}
/**
 * 新增分类
 * method post
 * data
 */
export function addType(data) {
  return request(UrlConfig+'/fcinformation/Plate/addPlate',option(data));
}
/**
 * 修改分类
 * method post
 * data
 */
export function editType(data) {
  return request(UrlConfig+'/fcinformation/Plate/updatePlate',option(data));
}
/**
 * 分类排序
 */
export function sortType(data) {
  return request(UrlConfig+'/fcinformation/Plate/changeSort',option(data));
}
